/**
 * JAVACC DEMO 1.0
 */
package com.apache.info.service.plugins;

import com.apache.api.manager.PluginConnector;
import com.apache.api.vo.ParamsVo;
import com.apache.api.vo.ResultEntity;
import com.apache.cache.util.Validator;
import com.apache.info.entity.PubInfoStatistics;
import com.apache.info.manager.PubInfoStatisticsManager;

/**
 * description:  信息统计表
 *
 * @author iussoft 创建时间：2016-10-15
 */
public class InfoStatisticsPluginImpl implements PluginConnector {

    private PubInfoStatisticsManager pubInfoStatisticsManager;

    /**
     * TODO 简单描述该方法的实现功能（可选）.
     *
     * @see PluginConnector#execute(ParamsVo)
     */
    public Object execute(ParamsVo vo) throws Exception {
        ParamsVo pvo = new ParamsVo();
        PubInfoStatistics ps = new PubInfoStatistics();
        if (Validator.isNull(String.valueOf(vo.getParams("createUser")))) {
            ps.setInfoUser(String.valueOf(vo.getParams("createUser")));
        }
        if (Validator.isNull(String.valueOf(vo.getParams("sortId")))) {
            ps.setSortId(String.valueOf(vo.getParams("sortId")));
        }
        pvo.setObj(ps);
        long count = pubInfoStatisticsManager.countInfo(pvo);
        ResultEntity entity = new ResultEntity();
        entity.setResult("true");
        entity.setEntity(count);
        entity.setMessage("方法执行成功");//////////////////////
        return entity;
    }

    public void setPubInfoStatisticsManager(PubInfoStatisticsManager pubInfoStatisticsManager) {
        this.pubInfoStatisticsManager = pubInfoStatisticsManager;
    }

}
